<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>积分平台</title>
		<meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1, user-scalable=no">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0">
        <meta name="apple-mobile-web-app-capable" content="yes">
        <meta name="apple-mobile-web-app-status-bar-style" content="black">
		<link rel="stylesheet" type="text/css" href="__INDEX__/mui/css/mui.min.css"/>
		<link rel="stylesheet" type="text/css" href="__INDEX__/css/iconfont.css"/>
		<link rel="stylesheet" type="text/css" href="__INDEX__/css/common.css"/>
		<link rel="stylesheet" type="text/css" href="__INDEX__/css/msg.css"/>
		<script src="__INDEX__/js/lib/font.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body>
	    <div class="mui-content">
	    	<div id="pullrefresh" class="mui-content mui-scroll-wrapper">
		      <div class="mui-scroll">
				  <h5 class="pl_count" style="text-align: center"><span id="shuju">{$company_comments['total']}条评论</span></h5>
		          <ul id="container" class="mui-table-view mui-table-view-chevron">
				  {foreach $company_comments['data'] as $k => $v}
		          	<li data="{$v['id']}">
		          		<div class="msg-lag">
		          			<div class="msg-info">
		          				<div class="mui-pull-left info-box" >
		          					<div class="head-portrait mui-pull-left">
						        		<!--<span class="portrait-name">{$v["nickname"]}</span>-->
										{if $v['portrait']}
										<img src="{:getImg($v['portrait'])}" width="100%" style="border-radius: 50%"/>
										{else}
										<img src="__INDEX__/images/touxiang.jpg" width="100%" style="border-radius: 50%"/>
										{/if}
						        	</div>
						        	<p class="mui-pull-left name">{$v["nickname"]}</p>
						        	<p class="mui-pull-left depName">{$v["departmen_name"]}</p>
						        	<time class="mui-pull-right time">{$v['shijian']}</time>
		          				</div>
		          				<div class=" mui-pull-left info-cont">
		          					<p class="info-text-cont">{$v["contents"]}</p>
		          				</div>
		          			</div>
		          		</div>
		          	</li>
				  {/foreach}


		          	<!--<li>
		          		<div class="msg-lag">
		          			<div class="msg-info">
		          				<div class="mui-pull-left info-box" >
		          					<div class="head-portrait mui-pull-left" style="background: #FF0000;">
						        		<span class="portrait-name">杨盼盼</span>
						        	</div>
						        	<p class="mui-pull-left name">杨盼盼</p>
						        	<p class="mui-pull-left depName">设计部</p>
						        	<time class="mui-pull-right time">16小时前</time>
		          				</div>
		          				<div class=" mui-pull-left info-cont">
		          					<p class="info-text-cont">功夫汗水不负有心人，努力加油！！！功夫汗水不负有心人，努力加油！！！</p>
		          				</div>
		          			</div>
		          		</div>
		          	</li>
		          	<li>
		          		<div class="msg-lag">
		          			<div class="msg-info">
		          				<div class="mui-pull-left info-box" >
		          					<div class="head-portrait mui-pull-left" style="background:#78B6FF ;">
						        		<span class="portrait-name">杨盼盼</span>
						        	</div>
						        	<p class="mui-pull-left name">杨盼盼</p>
						        	<p class="mui-pull-left depName">设计部</p>
						        	<time class="mui-pull-right time">16小时前</time>
		          				</div>
		          				<div class=" mui-pull-left info-cont">
		          					<p class="info-text-cont">功夫汗水不负有心人，努力加油！！！功夫汗水不负有心人，努力加油！！！</p>
		          				</div>
		          			</div>
		          		</div>
		          	</li>
		          	<li>
		          		<div class="msg-lag">
		          			<div class="msg-info">
		          				<div class="mui-pull-left info-box" >
		          					<div class="head-portrait mui-pull-left" style="background:#F5A623 ;">
						        		<span class="portrait-name">杨盼盼</span>
						        	</div>
						        	<p class="mui-pull-left name">杨盼盼</p>
						        	<p class="mui-pull-left depName">设计部</p>
						        	<time class="mui-pull-right time">16小时前</time>
		          				</div>
		          				<div class=" mui-pull-left info-cont">
		          					<p class="info-text-cont">功夫汗水不负有心人，努力加油！！！功夫汗水不负有心人，努力加油！！！</p>
		          				</div>
		          			</div>
		          		</div>
		          	</li>
		          	<li>
		          		<div class="msg-lag">
		          			<div class="msg-info">
		          				<div class="mui-pull-left info-box" >
		          					<div class="head-portrait mui-pull-left" style="background:#BCA6FF ;">
						        		<span class="portrait-name">杨盼盼</span>
						        	</div>
						        	<p class="mui-pull-left name">杨盼盼</p>
						        	<p class="mui-pull-left depName">设计部</p>
						        	<time class="mui-pull-right time">16小时前</time>
		          				</div>
		          				<div class=" mui-pull-left info-cont">
		          					<p class="info-text-cont">功夫汗水不负有心人，努力加油！！！功夫汗水不负有心人，努力加油！！！</p>
		          				</div>
		          			</div>
		          		</div>
		          	</li>-->

		          </ul>
		      </div>
		    </div>
		    <div class="comment">
	    		<textarea class="mui-pull-left" placeholder="请发表您的评论" id="cont" name="cont" rows="" cols=""></textarea>
	    		<button class="btn mui-pull-right" onclick="pinglun()">发送</button>
		   	 </div>
	    </div>
		<script src="__INDEX__/js/lib/zepto.js" type="text/javascript" charset="utf-8"></script>
		<script src="__INDEX__/mui/js/mui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="__INDEX__/mui/js/mui.view.js" type="text/javascript" charset="utf-8"></script>
		<script src="__INDEX__/layer_mobile/layer.js" type="text/javascript" charset="utf-8"></script>
		<script src="__INDEX__/js/common.js" type="text/javascript" charset="utf-8"></script>
		<script src="__INDEX__/js/msg.js" type="text/javascript" charset="utf-8"></script>
		<script>
            function pinglun(){
                cont = $("#cont").val();
                var str = '';
                var one_li = $("#container li").eq(0).attr("data");
                if(cont==''){
                    mui.alert("请输入你的评论");
				}else{
                    $.post("/index/Rankings/createcomment",{cont:cont,one_li:one_li},function(data){
                        console.log(data);
                    	if(data.code==200){
                    	    $.each(data.comments,function(k,v){
									str = '<li data='+v.id+'>'+
									'<div class="msg-lag">'+
									'<div class="msg-info">'+
									'<div class="mui-pull-left info-box" >'+
									'<div class="head-portrait mui-pull-left">';
									if(v.portrait){
									    str +='<img src="/static/uploads/'+v.portrait+'" width="100%" style="border-radius: 50%"/>';
									}else{
									    str+='<img src="__INDEX__/images/touxiang.jpg" width="100%" style="border-radius: 50%"/>';
									}
									str+='</div>'+
									'<p class="mui-pull-left name">'+v.nickname+'</p>'+
									'<p class="mui-pull-left depName">'+v.departmen_name+'</p>'+
									'<time class="mui-pull-right time">刚刚</time>'+
								'</div>'+
								'<div class=" mui-pull-left info-cont">'+
									'<p class="info-text-cont">'+v.contents+'</p>'+
								'</div>'+
								'</div>'+
								'</div>'+
								'</li>';
								$("#container").prepend(str);
							});
                            $("#cont").val("");
                            $("#shuju").text(data.count+'条评论');
                        }else if(data.code == 404){
                    	    mui.alert("暂不支持跨部门评论");

						}else{
                            mui.alert(data.msg);
						}
					});
				}
            }
		</script>
	</body>
</html>
